/*
 * Copyright (C) 2014 Виктор Сытник, <Victor.Sytnik@sovic.org.ua>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package ua.org.sovic.oClients.DB;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 *
 * @author Виктор Сытник, <Victor.Sytnik@sovic.org.ua>
 */

@DatabaseTable(tableName = "ElementType")
public class ElementType {
    @DatabaseField(generatedId = true)
    private int ID;
    @DatabaseField(canBeNull = false)
    private boolean type; // Type flags: false - Телефон, true - Ел.Почта
    @DatabaseField(canBeNull = false, unique=true)
    private String name;
    
    public final static boolean MAIL = true;
    public final static boolean PHONE = false;
    // Конструкторы
    public ElementType() {
        // all persisted classes must define a no-arg constructor with at least package visibility
    }
    // По умолчанию считаем что это телефон
    public ElementType(String name) {
        this.type = PHONE;
        this.name = name;
    }
    // Полный конструктор с именем и типом елемента
    public ElementType(String name, boolean type) {
        this.type = type;
        this.name = name;
    }
    
    // Методы get|set
    public void setType(boolean type) {
        this.type = type;
    }
    public void setName(String name) {
        this.name = name;
    }
    public boolean getType() {
        return type;
    }
    public String getName() {
        return name;
    }
    public int getID () {
        return ID;
    }
}
